﻿@model WebAppModel.UserScanQRInfoModel
@{
    Layout = null;
}

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <title></title>

    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <style>
        .imgHeader {
            text-align: center;
        }

            .imgHeader img {
                width: 80%;
            }

        .msbtn {
            height: 45px;
            font-size: 22px;
            letter-spacing: 6px;
            border: 2px solid white;
            background-color: #79BC1F;
        }


        #foot {
            width: 80%;
            height: 30px;
            position: fixed;
            bottom: -1px;
        }

        #ActivityURL, #ActivityURL > img {
            display: block;
            width: 100%;
            height: 100%;
            background: red;
        }
    </style>

    <script src="~/Content/bootstrap/js/jquery.min.js"></script>
    <script src="~/Content/bootstrap/js/bootstrap.min.js"></script>
    <script>
        //function PrefixInteger(num, length) {
        //    return ("0000000000000000" + num).substr(-length);
        //}
        //function GetQueryString(name)
        //{
        //    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        //    var r = window.location.search.substr(1).match(reg);
        //    if(r!=null)return  unescape(r[2]); return null;
        //}

        // 调用方法
        $(function () {

            IsActivity();


            //防伪查询
            $("#fwbtn").click(function () {
                if ($('#sycode').val() == '') { $.L.msgError('请输入溯源码'); return; }
                if ($('#fwcode').val() == '') { $.L.msgError('请输入防伪码'); return; }
                window.location.href = '~/AntiFake/Result.aspx?fwcode=' + $('#fwcode').val() + '&sycode=' + $('#sycode').val();
            });
            $("#sy").css('display', 'block');
            //溯源查询
            $("#sybtn").click(function () {
                if ($('#sycode2').val() == '') { $.L.msgError('请输入溯源码'); return; }
                window.location.href = '~/Origins/Index.aspx?sycode=' + $('#sycode2').val();
            });

        });


        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }

        function changeImg(itemId) {

            switch (itemId) {
                case 'fw':
                    $('#fw').css('display', 'block');
                    $('#sy').css('display', 'none');
                    $('#jf').css('display', 'none');
                    $('#hyjf').css('display', 'none');
                    $("#fwimg").attr('src', '../Content/Images/index/GG_11.png');
                    $("#syimg").attr('src', '../Content/Images/index/G_03.png');
                    $("#jfimg").attr('src', '../Content/Images/index/G_06.png');
                    $("#hyjfimg").attr('src', '../Content/Images/index/G_08.png');

                    break;
                case 'sy':
                    $('#fw').css('display', 'none');
                    $('#sy').css('display', 'block');
                    $('#jf').css('display', 'none');
                    $('#hyjf').css('display', 'none');
                    $("#fwimg").attr('src', '../Content/Images/index/G_11.png');
                    $("#syimg").attr('src', '../Content/Images/index/GG_03.png');
                    $("#jfimg").attr('src', '../Content/Images/index/G_06.png');
                    $("#hyjfimg").attr('src', '../Content/Images/index/G_08.png');
                    break;

                case 'jf':
                    $('#fw').css('display', 'none');
                    $('#sy').css('display', 'none');
                    $('#jf').css('display', 'block');
                    $('#hyjf').css('display', 'none');
                    $("#fwimg").attr('src', '../Content/Images/index/G_11.png');
                    $("#syimg").attr('src', '../Content/Images/index/G_03.png');
                    $("#jfimg").attr('src', '../Content/Images/index/GG_06.png');
                    $("#hyjfimg").attr('src', '../Content/Images/index/G_08.png');Marketing/
                    break;
                case 'hyjf':
                    $('#fw').css('display', 'none');
                    $('#sy').css('display', 'none');
                    $('#jf').css('display', 'none');
                    $('#hyjf').css('display', 'block');
                    $("#fwimg").attr('src', '../Content/Images/index/G_11.png');
                    $("#syimg").attr('src', '../Content/Images/index/G_03.png');
                    $("#jfimg").attr('src', '../Content/Images/index/G_06.png');
                    $("#hyjfimg").attr('src', '../Content/Images/GG_08.png');
                    break;
            }
        }

        function doLogin() {
            window.location.href = '~/EnterpriseTool/Index.aspx?sycode=' + getUrlParam("code");
        }

        //根据扫码判断  是否有活动
        function IsActivity() {
            $.ajax({
                url: "/app/Marketing/IsMarketing",
                success: function (data) {

                    if (data.b == 1) {
                        $("#foot").show();
                        $("#foot #ActivityURL").attr("href", "/app/WebTemplate/WebTemplate1_1");
                    }
                }
            });
        }
    </script>
</head>
<body style="background-color:#F2F2F2;width:100%;">

    <form id="form1" runat="server">
        <div style="width:100%;margin-top:100px;"></div>
        <div class="row" style="width:80%;text-align:center;margin:auto;">
            <img src="~/Content/Images/index/logo.png" class="img-responsive" />
        </div>
        <div class="row" style="margin-top:50px;width:80%;text-align:center;margin:auto;">
            <p style="color:#2E2E2E;font-size:20px;font-family:'Microsoft YaHei'">产品身份的贴身管家</p>
        </div>
        <div class="row" style="margin-top:60px;width:80%;text-align:center;margin:auto;">
            <img src="~/Content/Images/index/qygj.png" style="max-width:200px;" onclick="doLogin();" />
        </div>
        <div style="margin-top:95px;margin-bottom:40px;">
            <div class="row" style="text-align:center;width:80%; margin:auto;">
                <div class="col-xs-3 imgHeader">

                    <img src="~/Content/Images/index/G_11.png" id="fwimg" style="max-width:200px;width:90%;" onclick="changeImg('fw');" />
                </div>
                <div class="col-xs-3 imgHeader">
                    <img src="~/Content/Images/index/GG_03.png" id="syimg" style="max-width:200px;width:90%;" onclick="changeImg('sy');" />
                </div>
                <div class="col-xs-3" style="text-align:center;">
                    <img src="~/Content/Images/index/G_06.png" id="jfimg" style="max-width:200px;width:90%;" onclick="changeImg('jf');" />
                </div>
                <div class="col-xs-3" style="text-align:center;">
                    <img src="~/Content/Images/index/G_08.png" id="hyjfimg" style="max-width:200px;width:90%;" onclick="changeImg('hyjf');" />
                </div>
            </div>
        </div>

        <div style="width:80%;margin:auto; display:none;" id="fw">
            <div class="form-group" style="width:65%;float:left;">
                <input type="text" class="form-control" id="sycode" value="@Model.Code"
                       placeholder="请输入16位溯源数字身份码" />
            </div>
            <div class="form-group" style="width:35%;float:left;">
                <input type="text" class="form-control" id="fwcode"
                       placeholder="输入4位验证码" />
            </div>
            <div class="form-group" style="width:100%;">
                <button id="fwbtn" type="button" class="btn btn-success" style="width:100%;background-color:#79BC1F;">码上查询</button>
            </div>
        </div>
        <div style="width:80%;margin:auto;display:none;" id="sy">
            <div class="form-group" style="width:100%;float:left;">
                <input type="text" class="form-control" id="sycode2" value="@Model.Code"
                       placeholder="请输入16位溯源数字身份码" />
            </div>
            <div class="form-group" style="width:100%;">
                <button id="sybtn" type="button" class="btn btn-success" style="width:100%;background-color:#79BC1F;">码上查询</button>
            </div>
        </div>

        <div style="width:80%;margin:auto;display:none;" id="jf">
            <div class="form-group" style="width:100%;">
                <input type="text" class="form-control" id="sjhm" runat="server"
                       placeholder="输入您的手机号码" />
            </div>
            <div class="form-group" style="width:100%;">
                <input type="text" class="form-control" id="sycode3" value="@Model.Code" runat="server"
                       placeholder="溯源码" />
            </div>
        </div>

        <div style="width:80%;margin:auto;display:none;" id="hyjf">
            <div class="form-group" style="width:100%;">
                <input type="text" class="form-control" id="sjhm2" runat="server"
                       placeholder="输入您的手机号码" />
            </div>
            <div class="form-group" style="width:100%;">
                <input type="text" class="form-control" id="mima" runat="server"
                       placeholder="输入密码" />
            </div>
        </div>
    </form>
    <footer id="foot" style="display:none;">
        <a id="ActivityURL">该商品有活动</a>
    </footer>

</body>

</html>
